const dao = require('./Dao');
const UserModel = require('../models/UserModel');

/**
 * 创建用户
 * @param {Object} obj 数据对象
 * @returns
 */
module.exports.create = async obj => await dao.create(UserModel, obj);

/**
 * 获取用户列表
 * @param {Object} conditions 条件集合
 * @returns
 */
module.exports.findAll = async conditions => await dao.findAll(UserModel, conditions);

/**
 * 获取一条用户数据
 * @param {Object} conditions 条件集合
 * @returns
 */
module.exports.findOne = async conditions => await dao.findOne(UserModel, conditions);

module.exports.findAndCountAll = async conditions => await dao.findAndCountAll(UserModel, conditions);

/**
 * 更新数据
 * @param {Object} obj 数据对象{fields:{},conditions:{}}
 * @returns
 */
module.exports.update = async obj => await dao.update(UserModel, obj);

/**
 * 删除数据
 * @param {Object} conditions 条件集合
 * @returns
 */
module.exports.delete = async conditions => await dao.destroy(UserModel, conditions);
